package 多线程.状态.阻塞线程;

public class 合并线程 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(new Demo());
        thread.start();
        for(int i=0;i<100;i++){
            if(i==50) thread.join();
            System.out.println("我是Main线程 "+i);
        }
    }
}

class Demo implements Runnable{
    @Override
    public void run() {
        for(int i=0;i<100;i++){
            System.out.println("我是线程 "+i);
        }
    }
}
